<?
 

//================================
// 记录日志:加入记录操作功能。

// ip           =地址=函数获取
// user         =角色=session/游客
// control      =操作=形参传递
// target_table =目标=形参传递
// target_data  =数据=形参传递
// date         =日期=自动录入
// remark       =备注=形参传递
//================================

function morea_blackbox($action,$target_table,$target_data,$remark,$location){



	error_reporting(E_ERROR);
	define('CURSCRIPT', 'forumdisplay');

    $dbHostname = "localhost";
    $dbUsername = "root";
    $dbPassword = "98154981";
    $dbName= "moerae";
            
    $dblink = MYSQL_CONNECT($dbHostname, $dbUsername, $dbPassword) OR DIE("数据库连接失败!");       
    mysql_select_db($dbName) or die( "Unable to select database ".$dbName); 
    mysql_query("set names utf8");


	
//设置需要搜索的表格的前缀后缀
$table = "moe_blackbox_record";
//设置需要搜索的表格的前缀后缀




$_ip           =$_SERVER["REMOTE_ADDR"]; 
$user          =$_SESSION['username'];

if((!$user) || ($user==""))
{$_user="未登录用户";}
else{$_user=$user;}
 

$_action       =$action;
$_target_table =$target_table;
$_target_data  =$target_data;
$_remark       =$remark;
$_location     =$location;
 



$sql = "INSERT INTO $table (
ip,
user,
action,
target_table,
target_data,
remark,
location
)

value (
'$_ip',
'$_user',
'$_action',
'$_target_table',
'$_target_data',
'$_remark',
'$_location'
)";

$query = mysql_query($sql) or die ('更新日志失败');

return "BBF";//black box finished
}



?>

